package com.lm.geodesy.example;

import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GlobalCoordinates;

public class DestinationExample {
    public static void main(String[] args) {
        GlobalCoordinates startPoint = new GlobalCoordinates(34.052235, -118.243683); // 洛杉矶

        // 距离（米）和方向（角度）
        double distance = 100000; // 100 公里
        double azimuth = 45; // 东北方向

        GeodeticCalculator calculator = new GeodeticCalculator();
        Ellipsoid reference = Ellipsoid.WGS84;

        GlobalCoordinates destination = calculator.calculateEndingGlobalCoordinates(
                reference, startPoint, azimuth, distance);

        System.out.println("新地点的经纬度: ");
        System.out.println("纬度: " + destination.getLatitude());
        System.out.println("经度: " + destination.getLongitude());
    }
}
